-
Notifications
You must be signed in to change notification settings - Fork 5
/
+layout.svelte
73 lines (58 loc) · 2.12 KB
/
+layout.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script lang="ts">
import "@/style/kit.css";
import type { Project } from "$lib/api/types";
import MainLayout from "$lib/components/layouts/MainLayout.svelte";
import SignedIn from "$lib/components/common/SignedIn.svelte";
// sidebars
import DocumentMetadata from "./sidebar/DocumentMetadata.svelte";
import Actions from "./sidebar/Actions.svelte";
import AddOns from "@/routes/app/sidebar/AddOns.svelte";
import Data from "./sidebar/Data.svelte";
import Projects from "./sidebar/Projects.svelte";
import Sections from "./sidebar/Sections.svelte";
import { embedUrl } from "@/api/embed";
import { pageImageUrl } from "@/api/viewer";
import { canonicalUrl } from "@/lib/api/documents";
export let data;
$: document = data.document;
$: projects = document.projects as Project[];
$: canonical_url = canonicalUrl(document).toString();
</script>
<svelte:head>
<!-- Insert canonical URL -->
<link rel="canonical" href={document.canonical_url.toString()} />
{#if document.noindex || document.admin_noindex}
<meta name="robots" content="noindex" />
{/if}
<!-- Social cards -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="og:url" content={canonical_url} />
<meta property="og:url" content={canonical_url} />
<meta property="og:title" content={document.title} />
<title>{document.title} - DocumentCloud</title>
<link
rel="alternate"
type="application/json+oembed"
href={embedUrl(document.canonical_url)}
title={document.title}
/>
{#if document?.description?.trim().length > 0}
<meta property="og:description" content={document.description} />
{/if}
<meta property="og:image" content={pageImageUrl(document, 0, 700)} />
</svelte:head>
<MainLayout>
<svelte:fragment slot="navigation">
<DocumentMetadata {document} />
<Sections sections={document.sections} />
<Data {document} />
<Projects {projects} />
</svelte:fragment>
<slot slot="content" />
<svelte:fragment slot="action">
<Actions {document} />
<SignedIn>
<AddOns pinnedAddOns={data.pinnedAddons} />
</SignedIn>
</svelte:fragment>
</MainLayout>